import {WeaTools} from "ecCom";
import * as urls from "./urls";

const {callApi} = WeaTools;

export const init = () => {
    let initurl = urls.PAGE_INIT_URL;
    return callApi(initurl, "POST", {});
}

export const loadTree = parentId => {
    let treeurl = urls.LOAD_TREE_URL;
    return callApi(treeurl, "POST", {parentId});
}

export const saveAddNode = params => {
    let favurl = urls.ADD_FAVOURITE_DIR;
    return callApi(favurl, "POST", {...params});
}

export const saveEditNode = params => {
    let favurl = urls.EDIT_FAVOURITE_DIR;
    return callApi(favurl, "POST", {...params});
}

export const saveFavourite = params => {
    let favurl = urls.SAVE_FAVOURITE_FROM_PAGE;
    return callApi(favurl, "POST", {...params});
}